﻿@model List<KRM.Core.tblHRDepartment>

@{
    ViewBag.Title = "Departments Management";
    Layout = "/views/shared/_HRLayout.cshtml";
}
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            Departments <small>Departments Management</small>
        </h3>
                 <ul class="page-breadcrumb breadcrumb" style="margin-bottom: 10px;">
                  <li>
                     <i class="icon-home"></i>
                     <a href="/Home">Home</a> 
                     <span class="icon-angle-right"></span>
                  </li>
                  <li>
                     <a href="/Employees">Management</a>
                     <span class="icon-angle-right"></span>
                  </li>
                  <li><a href="/Department/">Departments</a></li>
               </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<div class="row">
    
       <div id="DepartmentDetail" class="modal fade" tabindex="-1" data-width="600">
               
            <div style="height: 360px">
                <div style="height: 170px"></div>
                <div class="ajax-loading"></div>
            </div>         
    </div>
    <div id="addDepartment" class="modal fade" tabindex="-1" data-width="600">
        @Html.Partial("Create")  
    </div>
    <div class="col-md-12">
        @Html.Partial("Partial/_MessageResult")
    </div>

    <div class="col-md-12 table-toolbar" >
        <a href="#addDepartment"  data-toggle="modal"class="btn green">Add New <i class="icon-plus"></i></a>
    </div>
    <div class="col-md-12"> <table class="table table-striped table-bordered table-hover dataTable" >
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Description</th>
                                        <th>Image</th>
                                        <th style="width: 80px">Edit</th>
                                        <th  style="width: 88px">Delete</th>
                                        <th  style="width: 97px">Active</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (var item   in Model)
                                    {     
                                        <tr>
                                            <td style="text-align: center"><a href="/Employees?SiteId=0&DepartmentId=@item.Id&PositionId=0">@item.DepartmentName</a></td>
                                            <td style="text-align: center">@item.DepartmentDescription</td>
                                            <td style="text-align: center">@item.DepartmentImage</td>
                                            <td style="text-align: center">
                                                <a type="button" onclick="ViewDepartmentDetail(@item.Id)" href="#DepartmentDetail"data-toggle="modal" class="btn btn-sm blue">View <i class="icon-edit"></i></a>
                                            </td>
                                            <td style="text-align: center">
                                                <a href="/Department/Delete/@item.Id" onclick="javascript:return confirm('Are you sure?');" class="btn btn-sm red">Delete <i class="icon-remove"></i></a>
                                            </td>
                                            <td style="text-align: center">
                                                @if (@item.Active==false)
                                                {
                                                    <a href="/Department/Active/@item.Id?active=true" class="btn btn-sm green">Active <i class="icon-check"></i></a>
                                                }
                                                else
                                                { <a href="/Department/Active/@item.Id?active=false" class="btn btn-default btn-default-sm">Disable <i class="icon-remove"></i></a>
                                                }
                                            </td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
    </div>
</div>